#ifndef THREADPOOL_H_
#define THREADPOOL_H_

#include"head.h"
#include"hashmap.h"
#include"queue.h"
#include"sqlConnection.h"
#include<my_header.h>
typedef struct threadpool_s
{
    //锁
    pthread_mutex_t _mThreadLock;
    //条件变量
    pthread_cond_t _mThreadCond;
    //线程id
    pthread_t *_poolThreadId;
    //线程数量
    int _thread_num;
    //map存放config
    HashMap *_map;
    //队列放入上传下载
    queue_t _queue;
    //mysql相关
    sqlConnectPool *_sqlPool;
    
    int _exitFlag;//0为未退出，1为退出
}ThreadPool;



//初始化线程池
int initThreadPool(ThreadPool *pthreadpool);
//初始化连接
int initTcp(int *sockfd, char *ip, char *port);


int epollAdd(int epfd,int fd);
int epollDel(int epfd,int fd);

//在这个里面处理客户端的命令
int doRequest(int netfd, ThreadPool *pthreadpool);

void *threadFunc(void *arg);

#endif
